﻿#region Using
using System;
using System.Configuration;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Security;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text.RegularExpressions;
using System.Text;
using System.Xml;
using System.Runtime.InteropServices;


using Brandy.Utilites.Sugar;
using System.Security.Cryptography;
using System.Collections.Generic;
using System.Net;
using System.IO;
using System.Collections.Specialized;
using System.Configuration.Provider;
using System.Web.Hosting;

#endregion
namespace Brandy.Utilites
{
    /// <summary>
    /// Information 数据类型处理
    /// </summary>
    public class Information
    {

        /// <summary>
        /// 字段串是否为Null或为""(空)
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static bool StrIsNullOrEmpty(string str)
        {
            if (str == null || str.Trim() == string.Empty)
                return true;

            return false;
        }

        /// <summary>
        /// 确认对象是否为Date类型
        /// </summary>
        /// <param name="o"></param>
        /// <returns></returns>
        public static bool IsDate(object o)
        {
            if (o == null)
                return false;
            else if (o is DateTime)
                return true;
            else if (o is String)
            {
                try
                {
                    DateTime.Parse(o as String);
                    return true;
                }
                catch
                {
                }
            }
            return false;
        }

        /// <summary>
        /// 确认对象是否为Numberic类型
        /// </summary>
        /// <param name="o"></param>
        /// <returns></returns>
        public static bool IsNumeric(object o)
        {
            if (o == null || o is DateTime)
                return false;
            else if (o is Int16 || o is Int32 || o is Int64 || o is Decimal || o is Single || o is Double)
                return true;
            else
            {
                try
                {
                    if (o is String)
                        Double.Parse(o as String);
                    else
                        Double.Parse(o.ToString());
                    return true;
                }
                catch
                {
                }
            }
            return false;
        }




    }
}
